package com.zzptc.syl.traffic;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class See extends AppCompatActivity {
private Button btchaxun;
private List<String> list;
private EditText number;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_see);
        initview();
    }
    private boolean login(){
        boolean k=false;
        for (int i=0;i<list.size();i++){
            if (number.getText().toString().equals(list.get(i))){
                k=true;
                break;
            }
        }
        return k;
    }
    private void initview(){
        btchaxun=findViewById(R.id.bt_chaxun);
        number=findViewById(R.id.et_number);
        list=new ArrayList<>();
        list.add("A10001");
        list.add("A10002");
        list.add("A10003");
        list.add("A10004");
        list.add("A10005");
        list.add("A10006");
        btchaxun.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                if (login()){
                    Intent intent=new Intent(See.this,Query.class);
                    AppData.getInstance().setCarno(number.getText().toString());
                    startActivity(intent);
                }else {
                    Toast.makeText(See.this, "没有查询到鲁"+number.getText().toString(), Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

}